package morenoapp.model.impl;

import morenoapp.model.data.MorenoAnswerFace;
import morenoapp.model.data.MorenoAnswerItemFace;
import morenoapp.model.data.MorenoQuestionItemFace;
import morenoapp.model.data.MorenoRespondentFace;

/**
 *
 * @author dmitry.mamonov
 */
class MorenoAnswerItemImpl extends MorenoModelObject implements  MorenoAnswerItemFace {
    protected MorenoAnswerFace answer;
    protected MorenoQuestionItemFace questioItem;
    protected MorenoRespondentFace target;

    public MorenoAnswerItemImpl(MorenoAnswerImpl answer, MorenoQuestionItemFace questioItem, MorenoRespondentFace target) {
        super(answer.getModel());
        this.answer = answer;
        this.questioItem = questioItem;
        this.target = target;
    }

    @Override
    public MorenoAnswerFace getAnswer() {
        return this.answer;
    }

    @Override
    public MorenoQuestionItemFace getQuestionItem() {
        return this.questioItem;
    }

    @Override
    public MorenoRespondentFace getTarget() {
        return this.target;
    }

    @Override
    public void setTarget(MorenoRespondentFace target){
        this.target = target;
        getModel().fireRespondentChanged(answer.getRespondent());
    }
}
